var http = require("http");
var host = "127.0.0.1"
var port = "8080"
var server = http.createServer();
server.on("request",(request,response)=>{
   var method = request.method;
   if(method === "POST"){
     //处理post请求的数据
     var postData = ""
     request.on("data",(data)=>{
         postData = postData + data.toString()
     })
     request.on("end",()=>{
         console.log(postData)
     })
     console.log(postData)
   }else if(method === "GET"){
     console.log(request.url)
   }
   response.end("success")
})
//启动服务
server.listen(port,host,()=>{
    console.log("server is runing on http://127.0.0.1:8080")
})